# Maintainer: David Runge <dvzrv@archlinux.org>

_name=zita-jacktools
pkgname=python-zita-jacktools
pkgver=1.6.1
pkgrel=2
pkgdesc="Audio tools running as a Jack client"
arch=(loong64 x86_64)
url="https://kokkinizita.linuxaudio.org/linuxaudio"
license=(GPL3)
depends=(
  gcc-libs
  glibc
  python
  python-zita-audiotools
)
makedepends=(
  fftw
  jack
  libsndfile
  python-build
  python-installer
  python-setuptools
  python-wheel
  zita-convolver
  zita-jclient
  zita-resampler
)
optdepends=(
  'python-numpy: for examples'
  'python-pyqt5: for examples'
  'python-pyqt6: for examples'
)
source=(https://kokkinizita.linuxaudio.org/linuxaudio/downloads/$_name-$pkgver.tar.bz2)
sha512sums=('c3969f81f1d7ca93bfe72ba4ab036fe133db4574aeb47121344c6c729fbf1c433dc89a5cbfb0278a0e92b0b944df9ebea590d70ba7a5f87b0143aca6cefab5c6')
b2sums=('add63f0bbc130b9630e1139920fd8430e94aa5bc8f3410cd20e55a415b05e75fe0bbe3cab458f0b980bc914e8db8064cf82aeb86b894c32b25bedaa119f25469')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

package() {
  depends+=(
    fftw libfftw3f.so
    jack libjack.so
    libsndfile libsndfile.so
    zita-convolver libzita-convolver.so
    zita-jclient libzita-jclient.so
    zita-resampler libzita-resampler.so
  )

  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl

  # examples
  find examples -type f \( -iname "*.py" -or -iname "*README" -or -iname "*presets" \) -exec install -vDm 644 {} "$pkgdir/usr/share/doc/$pkgname/"{} \;
}
